日志样式

RIP V2 手动汇总

1.实验目的:
在路由器上启动RIPV2路由进程;
启用参与路由协议的接口,并且通告网络;
理解auto-summary 的开启和关闭;
查看和调试RIPV2路由协议的相关信息
2实验拓扑:
 
说明:R1上启动一个loopback0口.
R4:启动四个loopback0 口
开始实验:
分别配置好 四个路由的基本配置,和ip,路由的基本配置前面的实验已经讲过,故不在具体阐述,直接配置ip;
R1:
 
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R1
R1(config)#int s1/1
R1(config-if)#ip add 192.168.0.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int loop 0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
R2:
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R2
R2(config)#int s1/0
R2(config-if)#ip add 192.168.0.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int s1/1
R2(config-if)#ip add 192.168.1.1 255.255.255.0
R2(config-if)#no shut
R2(config-if)#exit
R2(config)#
*Nov 8 15:07:15.291: %LINK-3-UPDOWN: Interface Serial1/0, changed state to up
*Nov 8 15:07:15.363: %LINK-3-UPDOWN: Interface Serial1/1, changed state to up
R2(config)#
*Nov 8 15:07:16.295: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up
*Nov 8 15:07:16.367: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up
R2(config)#
 
R3:
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R3
R3(config)#int s1/0
R3(config-if)#ip add 192.168.1.2 255.255.255.0
R3(config-if)#no shut
R3(config-if)#int s1/1
R3(config-if)#ip add 192.168.2.1 255.255.255.0
R3(config-if)#no shut
R3(config-if)#exit
R3(config)#
*Nov 8 15:07:26.167: %LINK-3-UPDOWN: Interface Serial1/0, changed state to up
*Nov 8 15:07:26.235: %LINK-3-UPDOWN: Interface Serial1/1, changed state to up
R3(config)#
*Nov 8 15:07:27.171: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up
*Nov 8 15:07:27.239: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up
R3(config)#
 
R4:
Router(config)#host R4
R4(config)#int s1/0
R4(config-if)#ip add 192.168.2.2 255.255.255.0
R4(config-if)#no shut
R4(config-if)#int loop 0
R4(config-if)#ip add 2.2.2.2 255.255.255.0
R4(config-if)#no shut
R4(config-if)#int loop 1
R4(config-if)#ip add 2.2.3.2 255.255.255.0
R4(config-if)#no shut
R4(config-if)#int loop 2
R4(config-if)#ip add 2.2.4.2 255.255.255.0
R4(config-if)#no shut
R4(config-if)#int loop 3
R4(config-if)#ip add 2.2.5.2 255.255.255.0
R4(config-if)#no shut
R4(config-if)#exit
R4(config)#
*Nov 8 15:07:37.903: %LINK-3-UPDOWN: Interface Serial1/0, changed state to up
R4(config)#
*Nov 8 15:07:38.907: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up
R4(config)#
 
分别在四个路由上器RIPV2路由协议:
R1:
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#router rip
R1(config-router)#version 2 \\配置版本为2默认是版本1
R1(config-router)#no auto-summary \\关闭自动汇总
R1(config-router)#net 1.1.1.0
R1(config-router)#net 192.168.0.0 \\宣告网络
R1(config-router)#
R1(config-router)#^Z
R1#
*Nov 8 15:13:32.091: %SYS-5-CONFIG_I: Configured from console by console
R1#
 
R2:
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-s
R2(config-router)#net 192.168.0.0
R2(config-router)#net 192.168.1.0
R2(config-router)#^Z
R2#
*Nov 8 15:14:01.139: %SYS-5-CONFIG_I: Configured from console by console
R2#
 
R3:
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#net 192.168.1.0
R3(config-router)#net 192.168.2.0
R3(config-router)#no auto-s
R3(config-router)#^Z
R3#
*Nov 8 15:14:53.839: %SYS-5-CONFIG_I: Configured from console by console
R3#
 
R4:
*Nov 8 15:07:38.907: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up
R4(config)#router rip
R4(config-router)#version 2
R4(config-router)#net 192.168.2.0
R4(config-router)#net 2.2.2.0
R4(config-router)#net 2.2.3.0
R4(config-router)#net 2.2.4.0
R4(config-router)#net 2.2.5.0
R4(config-router)#no auto-s
R4(config-router)#^Z
R4#
*Nov 8 15:16:39.635: %SYS-5-CONFIG_I: Configured from console by console
R4#
在R1上“show ip route”查看路由表:
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 4 subnets
R 2.2.2.0 [120/3] via 192.168.0.2, 00:00:16, Serial1/1
R 2.2.3.0 [120/3] via 192.168.0.2, 00:00:16, Serial1/1
R 2.2.4.0 [120/3] via 192.168.0.2, 00:00:16, Serial1/1
R 2.2.5.0 [120/3] via 192.168.0.2, 00:00:16, Serial1/1
C 192.168.0.0/24 is directly connected, Serial1/1
R 192.168.1.0/24 [120/1] via 192.168.0.2, 00:00:16, Serial1/1
R 192.168.2.0/24 [120/2] via 192.168.0.2, 00:00:16, Serial1/1
R1#
 
注:可以看到R1的路由表中有R4的四条环回接口的明细路由,并且是没有经过汇总的,因为我们已经通过“no auto-summary”命令关闭了每个路由的自动汇总,下面我们来手动汇总R4。
 
R1 R2 R3 三个路由配置如上,看R4:
 
Enter configuration commands, one per line. End with CNTL/Z.
R4(config)#int s1/0
R4(config-if)#ip summary-address rip 2.2.0.0 255.255.248.0
R4(config-if)#^Z
R4#
*Nov 8 15:48:21.759: %SYS-5-CONFIG_I: Configured from console by console
R4#
 
30秒后我们查看R1的路由表:
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/21 is subnetted, 1 subnets
R 2.2.0.0 [120/3] via 192.168.0.2, 00:00:27, Serial1/1
C 192.168.0.0/24 is directly connected, Serial1/1
R 192.168.1.0/24 [120/1] via 192.168.0.2, 00:00:27, Serial1/1
R 192.168.2.0/24 [120/2] via 192.168.0.2, 00:00:27, Serial1/1
R1#
 
上面输出说明R1已经接收到了汇总路由,当然R2 R3 也能接受到,注意比较下未汇总前的R1路由表信息。
 
下面我们看下路由更新的过程:
R1#debug ip rip
RIP protocol debugging is on
R1#
*Nov 8 16:15:56.395: RIP: sending v2 update to 224.0.0.9 via Serial1/1 (192.168.0.1)
*Nov 8 16:15:56.395: RIP: build update entries
*Nov 8 16:15:56.399: 1.1.1.0/24 via 0.0.0.0, metric 1, tag 0
R1#
*Nov 8 16:16:07.179: RIP: received v2 update from 192.168.0.2 on Serial1/1
*Nov 8 16:16:07.179: 2.2.0.0/21 via 0.0.0.0 in 3 hops
*Nov 8 16:16:07.179: 192.168.1.0/24 via 0.0.0.0 in 1 hops
*Nov 8 16:16:07.179: 192.168.2.0/24 via 0.0.0.0 in 2 hops
R1#
*Nov 8 16:16:13.551: RIP: sending v2 update to 224.0.0.9 via Loopback0 (1.1.1.1)
*Nov 8 16:16:13.551: RIP: build update entries
*Nov 8 16:16:13.551: 2.2.0.0/21 via 0.0.0.0, metric 4, tag 0
*Nov 8 16:16:13.551: 192.168.0.0/24 via 0.0.0.0, metric 1, tag 0
*Nov 8 16:16:13.551: 192.168.1.0/24 via 0.0.0.0, metric 2, tag 0
*Nov 8 16:16:13.551: 192.168.2.0/24 via 0.0.0.0, metric 3, tag 0
*Nov 8 16:16:13.551: RIP: ignored v2 packet from 1.1.1.1 (sourced from one of our addresses)
R1#
*Nov 8 16:16:26.319: RIP: sending v2 update to 224.0.0.9 via Serial1/1 (192.168.0.1)
*Nov 8 16:16:26.319: RIP: build update entries
*Nov 8 16:16:26.323: 1.1.1.0/24 via 0.0.0.0, metric 1, tag 0
R1#
*Nov 8 16:16:33.687: RIP: received v2 update from 192.168.0.2 on Serial1/1
*Nov 8 16:16:33.691: 2.2.0.0/21 via 0.0.0.0 in 3 hops
*Nov 8 16:16:33.691: 192.168.1.0/24 via 0.0.0.0 in 1 hops
*Nov 8 16:16:33.695: 192.168.2.0/24 via 0.0.0.0 in 2 hops
R1#
*Nov 8 16:16:39.523: RIP: sending v2 update to 224.0.0.9 via Loopback0 (1.1.1.1)
*Nov 8 16:16:39.523: RIP: build update entries
*Nov 8 16:16:39.527: 2.2.0.0/21 via 0.0.0.0, metric 4, tag 0
*Nov 8 16:16:39.527: 192.168.0.0/24 via 0.0.0.0, metric 1, tag 0
*Nov 8 16:16:39.531: 192.168.1.0/24 via 0.0.0.0, metric 2, tag 0
*Nov 8 16:16:39.531: 192.168.2.0/24 via 0.0.0.0, metric 3, tag 0
*Nov 8 16:16:39.535: RIP: ignored v2 packet from 1.1.1.1 (sourced from one of our addresses)
R1#
 
总结:需要注意几点RIPV2的几点特征:
1,路由更新过程中携带子网信息
2,采用组播(224.0.0.9)更新,更新过程如下:
3,不支持CIDR汇总,但可以传递CIDR汇总。(下一个实验将介绍)